You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(connections): preserve SSM cleanup notices across connection lifecycles - #296
SSM cleanup notices now appear after failed or cancelled connections, connection tests, and reconnects—not only explicit disconnects. Closing the connection form or replacing a connection no longer discards the cleanup result.
Cleanup also recovers a session ID that arrives late from CLI output, with a bounded background wait that ends early at EOF. Local tunnel cleanup remains immediate, and AWS authentication is unchanged.
Testing
2,517 local tests passed; formatting and Clippy passed. Regression tests cover notice delivery across the connection lifecycle, late session IDs, and EOF; mutation checks confirmed the relevant tests detect regressions.
Rebuilt macOS dev app tested with fake AWS tools: failed connect/Test, cancellation, missing session ID, Copy/Dismiss, reconnect, and disconnect. A disposable local PostgreSQL query passed before and after reconnect; fixture processes and ports were cleaned up.
No live AWS tests were run. UI testing used accessibility and keyboard actions because coordinate clicks/captures were unreliable; smooth rendering was not verified. Fork CI results are separate from these local checks.
Limitations
Remote termination remains best effort, with no persistent retry or crash recovery. Notices are in memory and can be lost on app exit. Displayed AWS profile and region are configured values, not verified account/effective-region identity.
Compatibility
No saved-profile format changes. Existing SSM downgrade protection remains unchanged.
AI assistance
Developed with substantial AI assistance, including implementation, review, regression tests, and local testing.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Improved cleanup reporting for SSM connections and form tests, including failed or cancelled attempts, reconnects, and disconnects. Cleanup results are surfaced even when they arrive late or before observation begins.
Cleanup now waits up to one second for delayed session details, or stops waiting when output ends. Local teardown can finish without waiting for this background cleanup.
Documentation
Clarified when SSM cleanup results may appear and how delayed cleanup is handled.
SSM tunnel cleanup waits up to one second for a session ID from stdout, or until stdout reaches EOF. Workspace observers handle SSM cleanup results for connection attempts and form tests, including results reported before observation and after related forms or profiles change.
Changes: SSM Cleanup Lifecycle
Layer / File(s)
Summary
Tunnel session discovery and termination src/db/ssm.rs
Stdout draining records EOF. Background cleanup waits for a session ID or EOF, up to one second, before attempting remote termination. Tests cover delayed IDs, timeout, and EOF.
Workspace observes SSM connection and form-test attempts without storing attempts on profiles. Unaccepted cleanup results are added to cleanup notices, including results reported before observation. Tests cover failed and cancelled connections and form tests, reconnects, and disconnects. Documentation describes the expanded cleanup cases and bounded session-ID wait.
ShayanAbbas1/dbdelve#280: Added the unconfirmed SSM cleanup notice that this PR extends to more connection and form-test lifecycle cases.
ShayanAbbas1/dbdelve#297: Builds on this PR’s pending cleanup-result handling with retries, pause and resume states, and reopening notices.
ShayanAbbas1/dbdelve#259: Added the SSM tunnel cleanup flow that this PR updates to wait for late session IDs and preserve cleanup results.
Suggested reviewers:neoterux, shayanabbas1
Merge Risk: Minimal · up to c28a6
This change makes SSM cleanup notices appear after failed or cancelled connections, connection tests, and reconnects, and it recovers late-arriving session IDs. I found no concrete merge-blocking risk. Remote termination remains best effort, and notices are lost if the app exits.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: SSM cleanup notices are preserved across connection lifecycles (failed or cancelled connections, connection tests, reconnects, and disconnects). The raw summary confir…
Description check
The description is directly related to the changeset. It states that SSM cleanup notices now appear after failed or cancelled connections, connection tests, and reconnects. It also covers the bounded …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: SSM cleanup notices are preserved across connection lifecycles (failed or cancelled connections, connection tests, reconnects, and disconnects). The raw summary confirms the cleanup observer, retained results when no observer is registered, and the late session-ID wait. The conventional-commit prefix and length are acceptable.
Full details: Description check
Explanation
The description is directly related to the changeset. It states that SSM cleanup notices now appear after failed or cancelled connections, connection tests, and reconnects. It also covers the bounded late session-ID wait, the EOF handling, the local-teardown behavior, and the test coverage. This matches the raw summary of the docs, the SSM cleanup logic in src/db/ssm.rs, and the workspace changes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit watches stdout flow, A session ID appears below. EOF may end the waiting flight, Or one short second marks the night. Cleanup notices find their way, Through forms and profiles, come what may.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 16761076-0d81-49a4-bbbc-a95a21419a03
Commits
Reviewing files that changed from the base of the PR and between 51e3b00 and c28a620.
Files selected for processing: 2
src/workspace/e2e.rs
src/workspace/mod.rs
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Recent review details
Context from checks skipped due to timeout: 5
GitHub Check: CodeRabbit
GitHub Check: windows
GitHub Check: macos
GitHub Check: linux
GitHub Check: db2
Additional context used
Code guidelines: 1
docs/agents/session.md — auto-discovered
Path-based instructions: 1
Applicability reference: AGENTS.md: # AGENTS.md `src/workspace/e2e.rs` launches the app headless and drives it through the real keymap and focus path, so a change to keyboard or focus behaviour adds a test there.
Learnt from: CR
Repo: ShayanAbbas1/dbdelve
Timestamp: 2026-11-19T05:59:34.682Z
Learning: Applicability reference:
AGENTS.md: # AGENTS.md
## Reference
Read the file a task touches before changing that area:
- `docs/agents/ssh-tunnels.md`: **SSH tunnels**: the system-`ssh` forward, its
Source excerpt:
# SSH tunnels
## AWS SSM
SSM cleanup reports a bounded one-time termination result through the runtime
connection attempt when its tunnel is finally dropped. The workspace subscribes
for each SSM connect and form test, independently of the form and profile
generation, so cancellation, failure, and reconnect cannot discard the result.
Background cleanup waits up to one second for a late stdout session ID, ending
early on stdout EOF; local teardown does not wait for that drain. A session
whose ID never arrives still produces an uncertainty notice.
The window keeps unconfirmed results separately from other notices;
profile and region are configured settings, not verified identity. No result
is persisted, and the local watchdog never waits for the remote request.
Learning: 2026-11-03T15:05:41.504Z
Learnt from: CR
Repo: ShayanAbbas1/dbdelve PR: 0
File: docs/agents/session.md:0-0
Timestamp: 2026-11-03T15:05:41.504Z
Learning: Applies to src/workspace/e2e.rs : Applicability reference:
AGENTS.md: # AGENTS.md
## Build, run and check
`src/workspace/e2e.rs` launches the app headless and drives it through the
real keymap and focus path, so a change to keyboard or focus behaviour adds a
test there. Its gotchas are in `docs/agents/session.md`.
AGENTS.md: # AGENTS.md
## Platforms
Paths per platform and the rest of storage are in `docs/agents/session.md`.
AGENTS.md: # AGENTS.md
## Reference
Read the file a task touches before changing that area:
- `docs/agents/session.md`: **projects, the palette, the connection form, tabs
Source excerpt:
# Session and tabs
- **The e2e harness (`src/workspace/e2e.rs`) has gotchas.** A test never
waits on a statement that is still running: a running tab re-arms its clock
and streaming timers, the test scheduler fires them at once, and
`run_until_parked` (so `simulate_keystrokes` too) never returns. Assert on
what a chord resolves to instead, or run to completion first.
...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #280 and #259.
SSM cleanup notices now appear after failed or cancelled connections, connection tests, and reconnects—not only explicit disconnects. Closing the connection form or replacing a connection no longer discards the cleanup result.
Cleanup also recovers a session ID that arrives late from CLI output, with a bounded background wait that ends early at EOF. Local tunnel cleanup remains immediate, and AWS authentication is unchanged.
Testing
Limitations
Remote termination remains best effort, with no persistent retry or crash recovery. Notices are in memory and can be lost on app exit. Displayed AWS profile and region are configured values, not verified account/effective-region identity.
Compatibility
No saved-profile format changes. Existing SSM downgrade protection remains unchanged.
AI assistance
Developed with substantial AI assistance, including implementation, review, regression tests, and local testing.